package com.itheima.myreflect.Demo3;

import java.lang.reflect.Field;
import java.util.ArrayList;

public class demo3 {
    public static void main(String[] args) throws Exception {
        ArrayList list = new ArrayList();
        System.out.println(list.size());

        Class<ArrayList> listClass = ArrayList.class;
        Field sizeField = listClass.getDeclaredField("size");

        sizeField.setAccessible(true);
        sizeField.set(list,10);
        System.out.println(list.size());

    }
}